]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
Add a variant of the Restart dialog for offline updates
authorMatthias Clasen <mclasen@redhat.com>
Mon, 26 Aug 2013 04:52:41 +0000 (00:52 -0400)
committerMatthias Clasen <mclasen@redhat.com>
Mon, 26 Aug 2013 14:46:45 +0000 (10:46 -0400)
Detect when an offline update is pending, and show a more
suitable message in the Restart dialog.

https://bugzilla.gnome.org/show_bug.cgi?id=706612

js/ui/endSessionDialog.js

index 61e4d6b74e6f9e6caa5502c2a912824395823d7e..3e7f826ea842e6bfef7870d2a64c859379549a66 100644 (file)
@@ -104,10 +104,25 @@ const restartDialogContent = {
     iconStyleClass: 'end-session-dialog-shutdown-icon'
 };
 
+const restartInstallDialogContent = {
+
+    subject: C_("title", "Restart & Install Updates"),
+    description: function(seconds) {
+        return ngettext("The system will automatically restart and install updates in %d second.",
+                        "The system will automatically restart and install updates in %d seconds.",
+                        seconds).format(seconds);
+    },
+    confirmButtons: [{ signal: 'ConfirmedReboot',
+                       label:  C_("button", "Restart & Install") }],
+    iconName: 'view-refresh-symbolic',
+    iconStyleClass: 'end-session-dialog-shutdown-icon'
+};
+
 const DialogContent = {
     0 /* GSM_SHELL_END_SESSION_DIALOG_TYPE_LOGOUT */: logoutDialogContent,
     1 /* GSM_SHELL_END_SESSION_DIALOG_TYPE_SHUTDOWN */: shutdownDialogContent,
-    2 /* GSM_SHELL_END_SESSION_DIALOG_TYPE_RESTART */: restartDialogContent
+    2 /* GSM_SHELL_END_SESSION_DIALOG_TYPE_RESTART */: restartDialogContent,
+    3: restartInstallDialogContent
 };
 
 const MAX_USERS_IN_SESSION_DIALOG = 5;
@@ -192,6 +207,7 @@ const EndSessionDialog = new Lang.Class({
         this._loginManager = LoginManager.getLoginManager();
         this._userManager = AccountsService.UserManager.get_default();
         this._user = this._userManager.get_user(GLib.get_user_name());
+        this._updatesFile = Gio.File.new_for_path('/system-update');
 
         this._secondsLeft = 0;
         this._totalSecondsToStayOpen = 0;
@@ -273,6 +289,9 @@ const EndSessionDialog = new Lang.Class({
         if (!open)
             return;
 
+        if (this._type == 2 && this._updatesFile.query_exists(null))
+            this._type = 3;
+
         let dialogContent = DialogContent[this._type];
 
         let subject = dialogContent.subject;